package com.usian.feign;

import com.usian.pojo.*;
import com.usian.utils.CatResult;
import com.usian.utils.PageResult;
import com.usian.utils.Result;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "usian-item-service")
public interface ItemServiceFeign {
    /**
     * 查询商品基本信息
     */
    @RequestMapping("/service/item/selectItemInfo")
    TbItem selectItemInfo(@RequestParam("itemId") Long itemId);


    @RequestMapping("/service/item/selectTbItemAllByPage")
    public PageResult selectTbItemAllByPage(@RequestParam Integer page,
                                            @RequestParam Integer rows);


    /**
     * 根据类目 ID 查询当前类目的子节点
     */
    @RequestMapping("/service/itemCategory/selectItemCategoryByParentId")
    List<TbItemCat> selectItemCategoryByParentId(@RequestParam Long id);


   /* @RequestMapping("/backend/itemParam/selectItemParamByItemCatId/{itemCatId}")
    public TbItemParam selectItemParamByItemCatId(@PathVariable long itemCatId);
    */

   @PostMapping("/service/itemParam/selectItemParamByItemCatId")
   TbItemParam selectItemParamByItemCatId(@RequestParam Long itemCatId);


    //@GetMapping("/service/item/insertTbItem")
    @RequestMapping("/service/item/insertTbItem")
   Integer insertTbItem(@RequestBody TbItem tbItem,@RequestParam String desc,@RequestParam String itemParams);

    @RequestMapping("/service/item/deleteItemById")
    Integer deleteItemById(@RequestParam Long itemId);


    @RequestMapping("/service/item/preUpdateItem")
    Map<String,Object> preUpdateItem(@RequestParam String itemId);

    /**
     * 更新数据
     */
    @RequestMapping("/service/item/updateTbItem")
    Integer updateTbItem(@RequestBody TbItem tbItem,@RequestParam String desc,@RequestParam String itemParams);


    /**
     * 查询商品规格
     */
    @RequestMapping("/service/itemParam/selectItemParamAll")
    public PageResult selectItemParamAll(@RequestParam Integer page, @RequestParam Integer rows);



    //添加商品规格
    @RequestMapping("service/itemParam/insertItemParam")
    public Integer insertItemParam(@RequestParam Integer itemCatId,@RequestParam String paramData);

    //删除规格信息
    @RequestMapping("service/itemParam/deleteItemParamById")
    public Integer deleteItemParamById(@RequestParam Integer id);

    // 查询首页商品分类
    @RequestMapping("service/item/selectItemCategoryAll")
    public CatResult selectItemCategoryAll();

    /**
     * 查询商品介绍
     */
    @RequestMapping("service/item/selectItemDescByItemId")
    public TbItemDesc selectItemDescByItemId(@RequestParam Long itemId);

    /**
     * 根据商品 ID 查询商品规格参数
     */
    @RequestMapping("service/item/selectTbItemParamItemByItemId")
    public TbItemParamItem selectTbItemParamItemByItemId(@RequestParam Long itemId);
}
